<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This file documents the use of the GNU compilers.

Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Symbol-Renaming Pragmas (Using the GNU Compiler Collection (GCC))</title>

<meta name="description" content="Symbol-Renaming Pragmas (Using the GNU Compiler Collection (GCC))">
<meta name="keywords" content="Symbol-Renaming Pragmas (Using the GNU Compiler Collection (GCC))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Indices.html" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Pragmas.html" rel="up" title="Pragmas">
<link href="Structure_002dLayout-Pragmas.html" rel="next" title="Structure-Layout Pragmas">
<link href="Solaris-Pragmas.html" rel="prev" title="Solaris Pragmas">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
kbd.key {font-style: normal}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en_US">
<div class="subsection-level-extent" id="Symbol_002dRenaming-Pragmas">
<div class="nav-panel">
<p>
Next: <a href="Structure_002dLayout-Pragmas.html" accesskey="n" rel="next">Structure-Layout Pragmas</a>, Previous: <a href="Solaris-Pragmas.html" accesskey="p" rel="prev">Solaris Pragmas</a>, Up: <a href="Pragmas.html" accesskey="u" rel="up">Pragmas Accepted by GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Symbol_002dRenaming-Pragmas-1"><span>6.62.9 Symbol-Renaming Pragmas<a class="copiable-link" href="#Symbol_002dRenaming-Pragmas-1"> &para;</a></span></h4>

<p>GCC supports a <code class="code">#pragma</code> directive that changes the name used in
assembly for a given declaration. While this pragma is supported on all
platforms, it is intended primarily to provide compatibility with the
Solaris system headers. This effect can also be achieved using the asm
labels extension (see <a class="pxref" href="Asm-Labels.html">Controlling Names Used in Assembler Code</a>).
</p>
<dl class="table">
<dt><a id="index-pragma_002c-redefine_005fextname"></a><span><code class="code">redefine_extname <var class="var">oldname</var> <var class="var">newname</var></code><a class="copiable-link" href="#index-pragma_002c-redefine_005fextname"> &para;</a></span></dt>
<dd>
<p>This pragma gives the C function <var class="var">oldname</var> the assembly symbol
<var class="var">newname</var>.  The preprocessor macro <code class="code">__PRAGMA_REDEFINE_EXTNAME</code>
is defined if this pragma is available (currently on all platforms).
</p></dd>
</dl>

<p>This pragma and the <code class="code">asm</code> labels extension interact in a complicated
manner.  Here are some corner cases you may want to be aware of:
</p>
<ol class="enumerate">
<li> This pragma silently applies only to declarations with external
linkage.  The <code class="code">asm</code> label feature does not have this restriction.

</li><li> In C++, this pragma silently applies only to declarations with
&ldquo;C&rdquo; linkage.  Again, <code class="code">asm</code> labels do not have this restriction.

</li><li> If either of the ways of changing the assembly name of a
declaration are applied to a declaration whose assembly name has
already been determined (either by a previous use of one of these
features, or because the compiler needed the assembly name in order to
generate code), and the new name is different, a warning issues and
the name does not change.

</li><li> The <var class="var">oldname</var> used by <code class="code">#pragma redefine_extname</code> is
always the C-language name.
</li></ol>

</div>



</body>
</html>
